//
//  CQMineLoginViewController.m
//  HiChat
//
//  Created by dllo on 16/1/21.
//  Copyright © 2016年 wqiong. All rights reserved.
//

#import "CQMineLoginViewController.h"
#import "CQMineMainView.h"
#import "CQMineMainViewController.h"
#import "CQLoginViewController.h"
@interface CQMineLoginViewController ()<FromMainVCToLoginVCDelegate>
@property (nonatomic, retain) CQMineMainView *mineView;

@end

@implementation CQMineLoginViewController

+ (CQMineLoginViewController *)shareMineLogInVC
{
    static CQMineLoginViewController *logInVC = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        logInVC = [[CQMineLoginViewController alloc] init];
    });
    return logInVC;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.mineView = [[CQMineMainView alloc]initWithFrame:CGRectMake(0, 50, self.view.bounds.size.width, self.view.bounds.size.height)];
    self.mineView.delegate = self;
    [self.view addSubview:self.mineView];
    [_mineView release];

}
- (void)ChangeMainVCToLoginVC {
    CQLoginViewController *loginVC = [[CQLoginViewController alloc] init];
//    [self.navigationController pushViewController:loginVC animated:YES];
    [self presentViewController:loginVC animated:YES completion:^{
        
        
    }];
}
- (void)ChangeMainVCToLoginedVC {
//    CATransition *transition = [CATransition animation];
//    transition.duration = 3.0f;
//    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
//    transition.type = @"rippleEffect";
//    transition.subtype = kCATransitionFromRight;
//    transition.delegate = self;
//    [self.navigationController.view.layer addAnimation:transition forKey:nil];
    
   [self dismissViewControllerAnimated:NO completion:^{
       
   }];
}
- (void)viewWillAppear:(BOOL)animated {
    self.mineView.userNameTextField.text = nil;
    self.mineView.passWordTextField.text = nil;
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil];
    self.navigationItem.title = @"HiChat聊天";
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
